﻿namespace Hidistro.UI.SaleSystem.Tags
{
    using Hidistro.Core;
    using Hidistro.Entities;
    using System;
    using System.Runtime.CompilerServices;
    using System.Text;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Xml;

    public class js_Common_SubjectMoreLink : WebControl
    {
        protected override void Render(HtmlTextWriter writer)
        {
            writer.Write(this.RendHtml());
        }

        public string RendHtml()
        {
            XmlNode node = TagsHelper.FindCommentNode(this.CommentId, "morelink");
            StringBuilder builder = new StringBuilder();
            if (node != null)
            {
                builder.AppendFormat("<div class=\"morelink cssEdite\" type=\"morelink\" id=\"comments_{0}\" >", this.CommentId).AppendLine();
                builder.AppendFormat("<div class=\"storey-r\" id=\"yb\">");
                int result = 0;
                int.TryParse(node.Attributes["CategoryId"].Value, out result);
                builder.AppendFormat("<a href=\"{0}\"><img src=\"http://res.juseshop.com/templates/master/jusekeji/images/fmml/js-more.jpg\" border=\"0\"></a>", Globals.GetSiteUrls().SubCategory(result, null)).AppendLine();
                builder.AppendLine("</div></div>");
            }
            return builder.ToString();
        }

        public int CommentId { get; set; }
    }
}

